//
//  BaseVM.h
//  Customer
//
//  Created by tangang on 2017/8/23.
//  Copyright © 2017年 tangang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SVProgressHUD.h"
#import "AFNetworking.h"
#import "UserModel.h"



typedef NS_ENUM(NSInteger ,LotteryNumType){
    LotteryNumTypeCarPK10   =0,///北京赛车
    LotteryNumTypeBrings    =1,///大乐透
    LotteryNumTypeLottery3D =2,///福彩3D
    LotteryNumType11Select5 =3,///广东11选5
    LotteryNumTypeHappy10   =4,///广东十分快乐
    LotteryNumTypeNearlyThree   =5,///江苏快三
    LotteryNumTypeLottery   =6,///六合彩
    LotteryNumTypeArrangement3   =7,///排列三
    LotteryNumTypeArrangement5   =8,///排列五
    LotteryNumTypeSevenLecai   =9,///七乐彩
    LotteryNumTypeSevenStars   =10,///七星彩
    LotteryNumTypeChromosphere   =11,///双色球
    LotteryNumTypeAllTime   =12,///重庆时时彩
    LotteryNumTypeHappy12   =13,///快乐12
    LotteryNumTypeLuckyAirship   =14,///幸运飞艇
};

typedef NS_ENUM(NSInteger ,APIResponseStutus){
    APIResponseStutusSuccess        =100,///成功
    APIResponseStutusUnauthorized   =401,///未授权，需要重新登陆
};


@interface BaseVM : NSObject

@property (nonatomic ,strong) NSMutableArray *dataArr;
@property (nonatomic ,weak) UIViewController *viewCtrl;

@property (nonatomic ,strong) NSString  *city;

typedef void (^SuccessBlock) (id  returnValue);

typedef void (^RobenSuccessBlock) (id  returnValue,NSString *str);
typedef void (^FailBlock) (NSString *  errorMessage , NSError *  error);


@property (nonatomic ,copy) SuccessBlock refreshUIBlock;

- (LotteryNumType)getType:(NSInteger)lType;

- (NSString *)getTitle:(LotteryNumType)lType;


- (NSURLSessionDataTask *)POST_Field_Url:(NSString *)url
                                  Params:( id )params
                            successBlock:(SuccessBlock)success
                               failBlock:(FailBlock)fail;

- (NSURLSessionDataTask *)GET_Field_Url:(NSString *)url
                                 Params:( id )params
                           successBlock:(SuccessBlock)success
                              failBlock:(FailBlock)fail;

- (NSURLSessionDataTask *)getBanInfoWithCardId:(NSString *)card
                           successBlock:(SuccessBlock)success
                              failBlock:(FailBlock)fail;


///type  2 头像  3 评论
- (void)postImageWithImage:(UIImage *)image andType:(NSInteger)type andSuccess:(SuccessBlock)success andFail:(FailBlock)fail;

- (void)login;

- (AFHTTPSessionManager *)httpManager;

- (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

+(BaseVM *)manage;

@property (nonatomic ,strong) NSMutableArray    *lotteryArr;

- (void)cancelRequest;

@end
